package p2.view;

import java.awt.BorderLayout;

import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class ComboBoxPanel extends JPanel{

	private static final long serialVersionUID = 2040152282674212187L;

	private JLabel label;
	public JComboBox jcb; 
	
	public ComboBoxPanel(String name, String[] options){
		this.setLayout(new BorderLayout());
		label = new JLabel(name);
		this.add(label, BorderLayout.WEST);
		jcb = new JComboBox<>(options);
		this.add(jcb, BorderLayout.EAST);
	}
	
	public int getValue(){ return jcb.getSelectedIndex(); }
	public String getName(){ return (String) jcb.getSelectedItem(); }
}
